package cn.kt.controller.UserTeacher;

import cn.kt.common.vo.ktResult;
import cn.kt.pojo.TeacherPojo;
import cn.kt.service.UserTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class UserAddController {

    @Autowired
    UserTeacherService userTeacherService;

    @RequestMapping("/teacher-add")
    public String showUserAdd(){
        return "admin/index/teacher-add";
    }

    //添加使用者
    @PostMapping("/teacher-doAdd")
    @ResponseBody
    public ktResult doUserAdd(TeacherPojo teacherPojo){
//        ktResult kr = userTeacherService.addUser(teacherPojo);
        return ktResult.success();
    }

    //验证账号重复性
    @GetMapping("/teacher-checkUser")
    @ResponseBody
    public ktResult checkUser(@RequestParam(required = false) String account){
        return userTeacherService.checkUser(account);
    }

    //手机号重复验证
    @GetMapping("/teacher-checkPhone")
    @ResponseBody
    public ktResult checkPhone(@RequestParam(value = "phone") String Strphone){
        Long phone = Long.valueOf(Strphone);
        return userTeacherService.checkPhone(phone);
    }
}
